void main() {
  // 准备购物车数据
  List carts = [
    {"count": 2, "price": 10.0, "selected": false},
    {"count": 1, "price": 30.0, "selected": true},
    {"count": 5, "price": 20.0, "selected": false}
  ];

  print(isSelectedAll(carts));
}

bool isSelectedAll(List carts) {
  // 方式1
  // return carts.every((item) => item["selected"]);

  // 方式2: 假设成立法
  bool result = true;
  for (var item in carts) {
    if (!item["selected"]) {
      result = false;
      break;
    }
  }
  return result;
}
